//private X* ptr;
//X* get();
//X* release();
//void reset(X*=0);

#include <iostream>
#include <memory>
using namespace std;

class A {
public:
  int i;
  A(){i = 12;cout<<"A::A()"<<endl;}
  ~A(){cout<<"~A::A()"<<endl;}
  //error: constructors and destructors may not be cv-quilified
};

int main()
{
  A* ap = new A;
  cout<<"ap->i\t"<<ap->i<<endl;
  cout<<"---------"<<endl;
 
  auto_ptr<A> aptr(ap);
  A* bp = aptr.release();
  cout<<"---------"<<endl;
  auto_ptr<A> bptr(bp);
  bptr.reset(ap);
  //glibc detected: double free or corruption
 
  return 0;

}
